package com.sjz.han.industry.adapters;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.sjz.han.industry.R;
import com.sjz.han.industry.activites.MemberDetailActivity;

import net.cachapa.expandablelayout.ExpandableLinearLayout;


/**
 *团队适配器
 */
public class MainTeam2Adapter extends RecyclerView.Adapter<MainTeam2Adapter.ViewHolder> {
    private Context context;
    public MainTeam2Adapter(Context context) {
        this.context=context;
    }

    @Override
    public int getItemCount() {
//        return datas == null ? 0 : datas.size();
        return 5;
    }
    @Override
    public MainTeam2Adapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new MainTeam2Adapter.ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_team_item, parent, false));
    }

    @Override
    public void onBindViewHolder(final MainTeam2Adapter.ViewHolder holder, final int position) {
//        MainTeamDown2Adapter teamDownAdapter=new MainTeamDown2Adapter(context);
//        holder.team_two_recy.setLayoutManager(new LinearLayoutManager(context));
//        holder.team_two_recy.setAdapter(teamDownAdapter);
//        holder.team_body_rel.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                if(holder.team_expand.isExpanded()){
//                    holder.team_expand.collapse();
//                    holder.team_updown_img.setImageResource(R.mipmap.team_rightjt_icon);
//                }else{
//                    holder.team_expand.expand();
//                    holder.team_updown_img.setImageResource(R.mipmap.team_greenjt_icon);
//                }
//            }
//        });
//        holder.teamdown_title_tv.setText("四级会员(B)");
//        holder.team_hyxq_tv.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                context.startActivity(new Intent(context, MemberDetailActivity.class));
//            }
//        });
    }

    static class ViewHolder extends RecyclerView.ViewHolder {
        public ExpandableLinearLayout team_expand;
        public RelativeLayout team_body_rel;
        public ImageView team_updown_img;
        public RecyclerView team_two_recy;
        public TextView teamdown_title_tv;
        public TextView team_hyxq_tv;
        public ViewHolder(View itemView) {
            super(itemView);
//            team_expand=(ExpandableLinearLayout)itemView.findViewById(R.id.team_expand);
//            team_body_rel=(RelativeLayout)itemView.findViewById(R.id.team_body_rel);
//            team_updown_img=(ImageView)itemView.findViewById(R.id.team_updown_img);
//            team_two_recy=(RecyclerView)itemView.findViewById(R.id.team_two_recy);
//            teamdown_title_tv=(TextView)itemView.findViewById(R.id.teamdown_title_tv);
        }

    }
}